package BehaviorDesignPattern.IteratorPattern;

import BehaviorDesignPattern.IteratorPattern.interfase.Iterator;

public class TestIteratorPattern {
    public static void main(String[] args) {
        ConcreteAggregate aggregate = new ConcreteAggregate();
        aggregate.add(" 第一个 ");
        aggregate.add(" 第二个 ");
        aggregate.add(" 第三个 ");

        Iterator iterator = aggregate.createIterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }
    }
}
